package com.pllandxzx.controller;

import com.pllandxzx.dto.ResponseDTO;
import com.pllandxzx.service.MenuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.AccessType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName：MenuController
 * @Author: 阿⭐
 * @Date: 2025/6/18 15:07
 * @Description: TODO
 */
@Tag(name = "菜单管理")
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;

    @Operation(summary = "菜单列表", description = "获取所有菜单，以树形结构展示列表")
    @GetMapping("/list")
    public ResponseDTO getAllMenu(){
        return menuService.getAllMenu();
    }

    @Operation(summary = "角色权限", description = "获取roleId对应角色分配的菜单id")
    @GetMapping("/{roleId}/list")
    public ResponseDTO getRoleMenus(@PathVariable("roleId") long roleId){
        return menuService.getRoleMenus(roleId);
    }


}
